/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package action;

import com.opensymphony.xwork2.ActionSupport;
import dao.LoginDAO;
import dao.UserDAO;
import util.ConnectDB;
import util.IdbUtil;

/**
 *
 * @author duonghung1369
 */

public class LoginController extends BaseController{
    private String username;
    private String password;
    private IdbUtil _database;
    private LoginDAO _loginDAO;
    private UserDAO _userDAO;
    
    public LoginController()
    {
        _database = new ConnectDB();
        _loginDAO = new LoginDAO(_database);
        _userDAO = new UserDAO(_database);
    }
    
    public String login(){
        _database = new ConnectDB();
        boolean valid = _loginDAO.checkLogin(username, password);
        return valid ? SUCCESS : "fail";
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    
}